﻿using MySql.Data.MySqlClient;
using System.Configuration;
using System.Data;

namespace banjimange.Models
{
    public class Users
    {
        public static string SqlserverConnectStr = "server=127.0.0.1;charset=utf8;user id=root;persistsecurityinfo=True;database=test;Password=root";
        public static DataSet Query(string SQLString)
        {
            using (MySqlConnection connection = new MySqlConnection(SqlserverConnectStr))
            {
                DataSet ds = new DataSet();
                try
                {
                    connection.Open();
                    MySqlDataAdapter command = new MySqlDataAdapter(SQLString, connection);
                    command.Fill(ds, "ds");
                }
                catch (MySql.Data.MySqlClient.MySqlException ex)
                {
                    throw new Exception(ex.Message);
                }
                return ds;
            }
        }
    }
}
